
# 计算传入的字符串中数字，字母，空格，以及其他的个数
# def jishu(s):
#     digit = 0
#     ec =0
#     space =0
#     other=0
#
#     for i in s:
#         if i.isdigit():
#             digit+=1
#         elif i.isspace():
#             space+=1
#         elif i.isalpha():
#             ec+=1
#         else:
#             other+=1
#             print(i,end= '  ')
#     return (digit,ec,space,other)
#
#
# s='liuyichengshinidie    123456789'
# result =jishu(s)
# print(result)


#判断用户传入的对象长度(字符串，列表，元组）是否大于5
# def length(s,list,tup):
#     z=len(s)
#     list1=len(list)
#     tup1=len(tup)
#
#     if z>5:
#         print('字符串大于5')
#     else:
#         print('字符串小于5')
#     if list1>5:
#         print('列表大于5')
#     else:
#         print('列表小于5')
#     if tup1>5:
#         print('元组大于5')
#     else:
#         print('元组小于5')
#     return (z,list1,tup1)
#
# length('adadwadadad',[1,2,5],(1,2,3))

# 函数监测⽤⼾传⼊的对象（字符，列表，元组）的每⼀个元素是否有空内容
# def jc(x):
#     for i in a:
#         i=str (i)
#         if '' in i:
#             return ('有空格')
#         else:
#             return ('没空格')
#
# a='weqewqeqweqwee qew'
# result=jc(a)
# print(result)



#检查传⼊列表的⻓度，如果⼤于2，那么仅仅保留前两个⻓度的内容，并将新内
# 容返回给调用者

# def liu(list):
#     len_list=len(list)
#     if len_list>2:
#         print('长度大于2')
#         list1=list[0:2:1]
#     return list1
#
# a=[1,2,3,4,5,6,7]
# res=liu(a)
# print(res)


# 检查获取传⼊列表或元组的所有奇数位索引对应的元素，并将其作为新列表返回
# 给调用者
# def liu(list):
#     list1=[]
#     for i in range(0,len(list)):
#         if i%2==1:
#             list1.append(list[i])
#     return list1
#
# a=[1,2,3,4]
# res=liu(a)
# print(res)

# 计算传⼊字符串中的【数字】、【字⺟】、【空格】和【其他】的个数
# def liu(s):
#     digit_num=0
#     alpha_num=0
#     space_num=0
#     other_num=0
#     for i in s:
#         if i.isdigit():
#             digit_num+=1
#         elif i.isalpha():
#             alpha_num+=1
#         elif i.isspace():
#             space_num+=1
#         else:
#             other_num+=1
#     return (digit_num,alpha_num,space_num,other_num)
#
# a='12312dawdada dwwrasd'
# res=liu(a)
# print(res)